package com.tidc.api.controller;

import com.tidc.api.exception.UltraViresException;
import com.tidc.api.fallback.UserManagerFallbackFactory;
import com.tidc.api.pojo.UserOV;
import com.tidc.api.pojo.user.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassNmae UserManagerApi
 * @Description TODO
 * @Author 冯涛滔
 **/
@FeignClient(value = "USERMANAGER",fallbackFactory = UserManagerFallbackFactory.class)
public interface UserManagerApi {
	/**
	 * 注册账号
	 * @param teacher
	 * @return
	 */
	@RequestMapping(value = "/register",method = RequestMethod.POST)
	UserOV register(@RequestBody User teacher);

	/**
	 * 开关老师的权限
	 * @param teacher email
	 * @return
	 */
	@RequestMapping(value = "/teacher/switch",method = RequestMethod.PUT)
	UserOV switchTeacher(@RequestBody User teacher);

	@RequestMapping(value = "/user/info",method = RequestMethod.GET)
	UserOV<User> userInfo(@RequestParam("email") String email);


	@RequestMapping(value = "/school/student",method = RequestMethod.GET)
	UserOV<List<User>> listSchoolStudent(@RequestParam("id") int id);


	@RequestMapping(value = "/list/student/email",method = RequestMethod.GET)
	UserOV<List<String>> listStudentEmail(@RequestParam("list") List<Integer> list);

	@GetMapping("/student")
	UserOV<User> getStudent(@RequestParam("email") String email);
}
